package com.example.myservlet;

import com.example.anno.RequestMapping;
import com.example.bean.User;
import com.example.init.DbUtil;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;

@RequestMapping("/sqltoy")
@Slf4j
public class SqltoyTestServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) {
        try{
            test1();
        }catch (Exception e) {
            log.error(e.getMessage(), e);
        }
    }

    private void test1() throws Exception {
        // 5. 执行 CRUD 示例
        User user = new User();
        user.setXh("xh001");
        user.setXm("张三");
        Object obj = DbUtil.save(user);
        System.out.println(obj.toString());

    }

}